package com.zim.ta_service.utils;

import cn.hutool.core.util.HexUtil;

/**
 * 描述:
 *
 * @Author: ZimH
 * @Mobile: 182-5958-1506
 * @CreateDate: 2023/1/9 9:34
 * @Version: 1.0
 */

public class NumUtil {

	public static String hexToAscii(String hexStr) {
		StringBuilder output = new StringBuilder("");
		for (int i = 0; i < hexStr.length(); i += 2) {
			String str = hexStr.substring(i, i + 2);
			output.append((char) Integer.parseInt(str, 16));
		}
		return output.toString();
	}


	public static String intToAscii(int n) {
		final String toHex = HexUtil.toHex(n);
		return hexToAscii(toHex);
	}

}
